package com.example.administrator.yunniuusedcar.holder;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import com.example.administrator.common.ui.BaseAdapterRV;
import com.example.administrator.common.ui.BaseHolderRV;
import com.example.administrator.yunniuusedcar.R;
import com.example.administrator.yunniuusedcar.adapter.MainNewInfo_ButtomAdapter;
import com.example.administrator.yunniuusedcar.model.mode_benn.WZ_ArticlenListBean;

import java.util.List;

/**  当日头条 文章列表holder
 * Created by USER2015 on 2017/12/21.
 */

public class Info01NewBottomHolder extends BaseHolderRV<WZ_ArticlenListBean>{

    private RecyclerView recyclerView05;
    private MainNewInfo_ButtomAdapter homeRanCarAdapter;

    /**
     * 构造方法
     *
     * @param context     上下文对象
     * @param parent      指RecyclerView控件
     * @param adapter     适配器
     * 1@param layoutResId RecyclerView的一个item布局文件
     */
    public Info01NewBottomHolder(Context context, ViewGroup parent, BaseAdapterRV<WZ_ArticlenListBean> adapter) {
        super(context, parent, adapter, R.layout.item_recycleview2);
    }

    @Override
    public void onFindViews(View itemView) {
               recyclerView05 = (RecyclerView) itemView.findViewById(R.id.recycler_view6);

    }

    @Override
    protected void onRefreshView(WZ_ArticlenListBean bean1, int position) {
        bean = (WZ_ArticlenListBean)bean1;
            List<WZ_ArticlenListBean> data = (List<WZ_ArticlenListBean>) bean1.data;
//        List<WZ_ArticlenListBean> data =  bean.data;  ////

        recyclerView05.setLayoutManager(new LinearLayoutManager
                (context, LinearLayoutManager.VERTICAL, false));   //vertical
        //适配器
        homeRanCarAdapter = new MainNewInfo_ButtomAdapter(context, data);    //改
        recyclerView05.setAdapter(homeRanCarAdapter);

    }
}
